package edu.towson.cosc.cosc455.jyoun.project1;
import java.util.ArrayList;

public class SemanticAnalyzer {
	ArrayList<String> htmlfile = new ArrayList<String>();
	ArrayList<String> ptree = new ArrayList<String>();
	public void Semantic() throws CompilerException {
		
		ptree = MySyntaxAnalyzer.parsetree;
		for(int x = 0; x < ptree.size(); x++){
				if(ptree.get(x).equalsIgnoreCase("#Start Document")){
					htmlfile.add("<html>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Document")){
					htmlfile.add("</html>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Head")){
					htmlfile.add("<head>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Head")){
					htmlfile.add("</head>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Title")){
					htmlfile.add("<title>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Title")){
					htmlfile.add("</title>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Paragraph")){
					htmlfile.add("<p>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Paragraph")){
					htmlfile.add("</p>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Bold")){
					htmlfile.add("<b>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Bold")){
					htmlfile.add("</b>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Italics")){
					htmlfile.add("<i>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Italics")){
					htmlfile.add("</i>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start List")){
					htmlfile.add("<ul>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End List")){
					htmlfile.add("</ul>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Item")){
					htmlfile.add("<li>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Item")){
					htmlfile.add("</li>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Newline")){
					htmlfile.add("<br />");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Audio")){
					htmlfile.add("<audio control>");		
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Audio")){
					htmlfile.add("</audio>");
				}
				else if(ptree.get(x).equalsIgnoreCase("#Start Video")){
					htmlfile.add("<iframe src= ");
				}
				else if(ptree.get(x).equalsIgnoreCase("#End Video")){
					htmlfile.add("/>");
					
				}
			}
		}
	}

				

				
			
		
	
	